# Maintainer : Christian Rebischke <chris.rebischke@archlinux.org>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: AndyRTR <andyrtr at archlinux.org>

pkgname=iwd
pkgver=2.4
pkgrel=2
pkgdesc='Internet Wireless Daemon'
arch=('loong64' 'x86_64')
url='https://git.kernel.org/cgit/network/wireless/iwd.git/'
license=('LGPL')
depends=('glibc' 'readline' 'libreadline.so' 'ell')
makedepends=('python-docutils' 'dbus' 'systemd')
optdepends=('qrencode: for displaying QR code after DPP is started')
source=("https://www.kernel.org/pub/linux/network/wireless/iwd-${pkgver}.tar"{.xz,.sign})
# https://mirrors.edge.kernel.org/pub/linux/network/wireless/sha256sums.asc
sha256sums=('3a9c5e7ade45162e5c78b3d7035a2f4a6e20ba6b5974097c35a8f615493012f9'
            'SKIP')
validpgpkeys=('E932D120BC2AEC444E558F0106CA9F5D1DCF2659')
changelog=ChangeLog
install=iwd.install

build() {
  cd ${pkgname}-${pkgver}
	dbus-run-session ./configure --prefix=/usr \
	--sysconfdir=/etc \
	--localstatedir=/var \
	--libexecdir=/usr/lib/iwd \
	--enable-external-ell \
	--enable-wired \
	--enable-ofono \
	--enable-hwsim \
	--disable-tools
  make
}

check() {
  cd ${pkgname}-${pkgver}
  # pass broken tests - should reported upstream
  # One test fail because we need kernel capabilities that
  # we don't have inside of systemd-nspawn
  # this could only be fixed via changing our build environment
  make -k check || /bin/true
}

package() {
  cd ${pkgname}-${pkgver}
  make install DESTDIR="${pkgdir}"
  install -Dm 644 README -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
